package com.byfan.barter.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Author: FBY
 * @Description
 * @Version 1.0
 * @Date: 2021/5/14 14:57
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@ApiModel
@Table(name = "favorites")
public class Favorites implements Serializable {

    /**
     * 收藏记录唯一id
     */
    @ApiModelProperty(value = "收藏记录id（新增时不传参，修改收藏时要传参）")
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    /**
     * 收藏者openid
     */
    @ApiModelProperty(value = "用户的openId")
    @Column(name = "openid")
    private String openId;

    /**
     * 商品id
     */
    @ApiModelProperty(value = "商品的id")
    @Column(name = "commodity_id")
    private int commodityId;


    /**
     * 创建时间
     */
    @ApiModelProperty(value = "收藏时间（任何请求都不用传参）")
    @CreatedDate
    @Column(name = "creat_time")
    private Date creatTime;
}
